Skip to contentSkip to conversation

trap exceptions in user

Xenomai-help Gabriele Moabiti 2 participants 3 messages Oct 24, 2008

lore
Share & tools
lore
#0 lore raw

I have upgraded the kernel to 2.6.24 + xenomai 2.4.5

The custom exception doesn't work as I expected.

static rthal_trap_handler_t old_trap_handler;
In an the kernel driver I set:
old_trap_handler = rthal_trap_catch(&custom_trap_fault);
the custom handler is:
static int custom_trap_fault(unsigned event, unsigned domid, void *data) {
if (is_my_application(...) && i_want_to_manage_exception(event)) {
ManageCustomExceptions();
return RTHAL_EVENT_STOP; /* 1=STOP */
}
return ((rthal_trap_handler_t) old_trap_handler)(event, domid, data);
}

The exception 7 is passed to the xenomai exception handler (TS flag).

I consider now ManageCustomExceptions a function that do nothing.

INT 3 or 1
Adeos does what I expected. It returns and nothing done. The program continue happy to the next instruction.

INT 0 (divide error) or 16 (fpu exception)
The system hangs.
When I pass to xenomai It doesn't handle the exception and relax the thread an propagate to linux (I think as expected to do).
[in the xnpod_trap_fault, xnpod_shadow_p is true then xnshadow_relax is performed so the
routine return 0 (RTHAL_EVENT_PROPAGATE)]

Is it possible to customize such exceptions? Am I missing something?

Gabriele

Scopri il blog di Yahoo! Mail:
Trucchi, novità e scrivi la tua opinione.
http://www.ymailblogit.com/blog

#1 lore raw
Quoted 5 lines · Gabriele Moabiti

(...)
I consider now ManageCustomExceptions a function that do nothing. (...)
INT 0 (divide error) or 16 (fpu exception)
The system hangs.

It will not work. It is because you have to handle the exception. Otherwise, when returning to user-space, your programs tries the faulty exception again, triggers the handler, which does nothing, and loops indefinitely...

Signature · 1 line
					    Gilles.
#2 lore raw
Quoted 10 lines · Gilles Chanteperdrix
Quoted 5 lines · Gabriele Moabiti

(...)
I consider now ManageCustomExceptions a function that do nothing. (...)
INT 0 (divide error) or 16 (fpu exception)
The system hangs.

It will not work. It is because you have to handle the exception. Otherwise, when returning to user-space, your programs tries the faulty exception again, triggers the handler, which does nothing, and loops

I meant try the faulty *instruction* again

Quoted 2 lines

indefinitely...

Signature · 1 line
					    Gilles.